home *** CD-ROM | disk | FTP | other *** search
-
- { *************************************************************************
- ** **
- ** DeviceInfo - Version 1.0, (C)1992 by Thomas Schmid **
- ** Im Grenzacherhof 12 **
- ** This programm is Public Domain, CH- 4058 Basel **
- ** coded 18.02.1992 in PCQ-Pascal(1.2b). **
- ** Gibt Info über angegebenes Device aus. **
- ** Usage : **
- ** DeviceInfo Dfx: **
- ** **
- *************************************************************************
- }
-
- Program DeviceInfo;
-
- {$I "include:libraries/dos.i" }
- {$I "include:utils/parameters.i" }
- {$I "include:exec/exec.i" }
- {$I "include:utils/stringlib.i" }
-
- Const
- MaxSize = 80;
-
- Var
- MyLock : FileLock;
- Inf : InfoDataPtr;
- Ok : Boolean;
- Myfile : String;
- S, S1 : String;
- Size, Used, Bpb : Integer;
-
- Procedure Cls;
-
- Begin
- WriteLn("\f DeviceInfo V1.0 © 1992, by T.Schmid, Written in PCQ V1.2b\n");
- { writeln("xxxxx \n") spart ein writeln ! -----^ }
- End;
-
- Procedure AsdaLaVista(warum : String ; code : Integer);
-
- Begin
- If Inf <> Nil Then FreeMem(Inf,SizeOf(InfoData));
- If warum <> Nil Then WriteLn("",warum,"");
- Exit(code);
- End;
-
-
- Begin
- Myfile:=AllocString(80);
- GetParam(1,Myfile);
- If strlen(Myfile) = 0 Then AsdaLaVista(" DiskInfo V1.0, © 1992 T.Schmid - Usage : DiskInfo Dfx:",0);
-
- Inf:=InfoDataPtr( AllocMem( SizeOf(InfoData), MEMF_PUBLIC ) );
- If Inf=Nil Then AsdaLaVista("Kein Speicher",5);
-
- s:=AllocString(20); strcpy(S,"Beschreibbar");
- s1:=AllocString(20); strcpy(S1,"Dos");
-
- MyLock:=Lock(Myfile,ACCESS_READ);
- If MyLock = Nil Then AsdaLaVista("Konnte Schlüssel nicht holen.",5);
-
- Ok:=Info(MyLock,Inf);
- Unlock(MyLock); { ------- Wichtig !! -------- }
-
- If Ok = FALSE Then AsdaLaVista("Konnte keine Info über Device holen",10);
-
- Bpb := Inf^.id_BytesPerBlock;
- Size := Inf^.id_NumBlocks * Bpb DIV 1024;
- Used := Inf^.id_NumBlocksUsed * Bpb DIV 1024;
- Cls;
-
- WriteLn(" Info über Device : ", Myfile, "");
- WriteLn(" Grösse : ", Size, " KBytes ","");
- WriteLn(" Belegt : ", Used, " KBytes ","");
- WriteLn(" Frei : ", Size-Used, " KBytes ","");
- WriteLn(" Anzahl Bytes per Block : ", Inf^.id_BytesPerBlock, "");
-
- Case Inf^.id_DiskType of
- ID_NO_DISK_PRESENT : strcpy(S1,"Keine Disk");
- ID_UNREADABLE_DISK : strcpy(S1,"Disk nicht lesbar");
- ID_NOT_REALLY_DOS : strcpy(S1,"Keine Dos-Disk");
- ID_KICKSTART_DISK : strcpy(S1,"Kickstart-Disk");
- End;
-
- WriteLn(" Disk Type : ",S1,"");
- WriteLn(" Weiche Fehler : ",Inf^.id_NumSoftErrors,"");
-
- Case Inf^.id_DiskState of
- ID_WRITE_PROTECTED : strcpy(S,"Schreibgeschützt");
- ID_VALIDATING : strcpy(S,"Wird Validiert");
- End;
- WriteLn(" Device Status : ",S,"");
-
- { wichtig : }
- AsdaLaVista("\n C U in next CF !\n",0);
-
- End.
-